<!DOCTYPE html>
<title>Media Controls: timeline accessibility tests</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls></video>
<script>
async_test(t => {
  assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);

  var video = document.querySelector('video');
  video.src = '../content/test.ogv';

  var timeline = timelineElement(video);
  assert_not_equals(timeline, null);

  assert_equals(timeline.getAttribute('aria-valuetext'), 'elapsed time: 0:00');

  // Trigger events that will update the timeline internal state.
  video.currentTime = 3;
  video.addEventListener('timeupdate', t.step_func_done(() => {
    assert_equals(timeline.getAttribute('aria-valuetext'), 'elapsed time: 0:03');
  }), { once: true });
});
</script>
